﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using ODP.Model;
using ODP.Enum;

namespace ODP.DAL
{
    public class User
    {
        public ReturnMessage AddUserInfo(UserInfo ui)
        {
            ReturnMessage rm = new ReturnMessage();

            IList<ExecInfo> eiList = new List<ExecInfo>();

            ExecInfo ei = ODP.Helper.DALHelper.TSQLForInsertIntoAccess<UserInfo>(ui, FormName.user);
            eiList.Add(ei);

            rm = ODP.Helper.DALHelper.ExecTSQL(eiList);

            return rm;
        }

        public ReturnMessage UpdateUserInfo(UserInfo ui)
        {
            ReturnMessage rm = new ReturnMessage();

            IList<ExecInfo> eiList = new List<ExecInfo>();

            ExecInfo ei = ODP.Helper.DALHelper.TSQLForUpdateAccess<UserInfo>(ui, FormName.user,string.Format(" id = {0}",ui.id));
            eiList.Add(ei);

            rm = ODP.Helper.DALHelper.ExecTSQL(eiList);

            return rm;
        }

        public ReturnMessage AddFollowerInfo(FollowerInfo fi)
        {
            ReturnMessage rm = new ReturnMessage();

            IList<ExecInfo> eiList = new List<ExecInfo>();

            ExecInfo ei = ODP.Helper.DALHelper.TSQLForInsertIntoAccess(fi, FormName.follower);
            eiList.Add(ei);

            rm = ODP.Helper.DALHelper.ExecTSQL(eiList);

            return rm;
        }

        public UserInfo GetUserByUID(string id)
        {
            UserInfo ui = new UserInfo();



            return ui;
        }
    }
}
